<%@page import="java.util.Date"%>
<%@page import="com.pb.news4.entity.News4"%>
<%@page import="com.pb.news4.service.impl.News4ServiceImpl"%>
<%@page import="com.pb.news4.service.News4Service"%>
<%@page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
	// 设置请求的字符编码
	request.setCharacterEncoding("utf-8");
	//从请求中取出数据
	String categoryId = request.getParameter("categoryId");
	String title = request.getParameter("title");
	String author = request.getParameter("author");
	String summary = request.getParameter("summary");
	String content = request.getParameter("newscontent");
	// 提交数据库
	News4Service news4Service = new News4ServiceImpl();
	News4 news4 = new News4();
	news4.setCategoryId(Integer.parseInt(categoryId));
	news4.setTitle(title);
	news4.setAuthor(author);
	news4.setSummary(summary);
	news4.setContent(content);
	news4.setCreateDate(new Date());
	if(news4Service.add(news4)){ // 提交成功
		// 转发
		//request.getRequestDispatcher("news4DetailList.jsp").forward(request, response);
	%>
	<jsp:forward page="news4DetailList.jsp"></jsp:forward>
	<%};
	
	
%>

</body>
</html>